
from pyprocessing.fonts import textSize, createFont, textFont
from pyprocessing import text, fill, textAlign, CENTER, BASELINE
from processing.model.component import Component


class Description(Component):
    
    def __init__(self, text, ox1, oy1, color, size=16):  
        Component.__init__(self) 
        self.x = ox1
        self.y = oy1
        self.__text = text
        self.__color = color
        self.__font = createFont("Arial", size, True, False)
        
    def update(self):
        pass
    
    def draw(self):
        textFont(self.font)
        textAlign(CENTER, CENTER)
        fill(*self.color)
        text(self.text, self.gx, self.gy)
  
    @property
    def text(self):
        return self.__text
    
    @text.setter
    def text(self, value):
        self.__text = value

    @property
    def color(self):
        return self.__color

    @property
    def font(self):
        return self.__font